DensitySp

class DensitySp(val initialBaseValue: Number, val defaultFontScale: Boolean = true, val sortedCustomEntries: List<CustomSpEntry> = emptyList(), val ignoreMultiWindows: Boolean = false, val applyAspectRatio: Boolean = false, val customSensitivityK: Float? = null)

EN A class that allows defining custom Sp text dimensions based on screen qualifiers (UiModeType, Width, Height, Smallest Width).

The value is resolved using a Context and uses the base value or a custom value, applying dynamic scaling.

PT Classe que permite definir dimensões de texto Sp customizadas baseadas em qualificadores de tela (UiModeType, Largura, Altura, Smallest Width).

Constructors

Link copied to clipboard
private constructor(initialBaseValue: Number, defaultFontScale: Boolean = true, sortedCustomEntries: List<CustomSpEntry> = emptyList(), ignoreMultiWindows: Boolean = false, applyAspectRatio: Boolean = false, customSensitivityK: Float? = null)
constructor(initialBaseValue: Number)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun aspectRatio(enable: Boolean = true, sensitivityK: Float? = null): DensitySp

EN Allow applying aspect ratio based constraint scaling. PT Permite aplicar o redimensionamento baseado na proporção da tela.

Link copied to clipboard
fun dhem(context: Context): Float
Link copied to clipboard
fun dhsp(context: Context): Float
Link copied to clipboard
fun dsem(context: Context): Float

EN Resolve final value in pixels (WITHOUT font scale).

Link copied to clipboard

EN Resolves dsem, dhem, and dwem in one pass (fixed Sp / no font-scale path). PT Resolve dsem, dhem e dwem numa só passagem (Sp fixo / sem escala de fonte).

Link copied to clipboard
fun dssp(context: Context): Float

EN Resolve final value in pixels (WITH font scale).

Link copied to clipboard

EN Resolves dssp, dhsp, and dwsp in one pass (single UiModeType.fromConfiguration read). PT Resolve dssp, dhsp e dwsp numa só passagem.

Link copied to clipboard
fun dwem(context: Context): Float
Link copied to clipboard
fun dwsp(context: Context): Float
Link copied to clipboard

EN Allow ignoring the constraint scaling based on multi-window resizing properties. PT Permite ignorar o dimensionamento para os layouts de múltiplas janelas (divisão de tela).

Link copied to clipboard

EN Adds a new entry and re-sorts the list by priority, then by qualifier value (descending).

Link copied to clipboard
private fun resolvePx(context: Context, qualifier: DpQualifier, fontScaleOverride: Boolean? = null): Float

EN Resolves qualifier to px using the first matching CustomSpEntry, optionally overriding font scale. PT Resolve qualifier em px usando a primeira CustomSpEntry correspondente, com override opcional da escala de fonte.

Link copied to clipboard
private fun resolvePxInternal(context: Context, qualifier: DpQualifier, configuration: Configuration, currentUiModeType: UiModeType, fontScaleOverride: Boolean?): Float

EN Shared implementation for resolvePx, dsspDhspDwspPx, and dsemDhemDwemPx. PT Implementação compartilhada para resolvePx, dsspDhspDwspPx e dsemDhemDwemPx.

Link copied to clipboard
fun screen(orientation: Orientation = Orientation.DEFAULT, customValue: Number, finalQualifierResolver: DpQualifier? = null, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DensitySp

EN Priority 4: orientation only. PT Prioridade 4: apenas orientação.

fun screen(type: UiModeType, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DensitySp

EN Priority 2: UiModeType only (e.g. TELEVISION, WATCH). PT Prioridade 2: apenas UiModeType (ex.: TELEVISION, WATCH).

fun screen(type: DpQualifier, value: Int, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DensitySp

EN Priority 3: Dp qualifier (sw, h, w) without UiModeType restriction. PT Prioridade 3: qualificador Dp (sw, h, w) sem restrição de UiModeType.

fun screen(uiModeType: UiModeType, qualifierType: DpQualifier, qualifierValue: Number, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DensitySp

EN Priority 1: Most specific qualifier — combines UiModeType and Dp qualifier (sw, h, w). PT Prioridade 1: qualificador mais específico — combina UiModeType e qualificador Dp (sw, h, w).